<div class="grid_9">
<h3>Todos <?php echo anchor('todos/deleteall', 'delete all todos', array("class" => "titlelink")); ?></h3>
<ol class="list">
<?php foreach($query->result() as $row) { ?>
<li>
<p>complete by <?=$row->thedate?> // <?=anchor('todos/delete/' . $row->todo, 'delete')?> <?=anchor('todos/edit/' . $row->todo, 'edit')?> </p>
<h4><input type="checkbox" onClick="window.location ='<?php echo $this->config->item('base_url') . $this->config->item('index_page') .'/todos/complete/' . $row->todo ?>' "name="complete" /> <?=$row->fname?>: <?=$row->description?></h4>
</li>
<?php } ?>
</ol>


<ol class="list completed">
<?php foreach($completed->result() as $row) { ?>
<li>
<p>completed on <?=$row->thedate?> // <?=anchor('todos/delete/' . $row->todo, 'delete')?></p>
<h4><input type="checkbox" onClick="window.location ='<?php echo $this->config->item('base_url') . $this->config->item('index_page') .'/todos/uncomplete/' . $row->todo ?>'" checked="true" name="complete" /><?=$row->fname?>: <?=$row->description?></h4>
</li>
<?php } ?>
</ol>
</div>

<div class="grid_7">
<h3>Add a todo</h3>
<?php echo form_open('todos/do_add');?>
<ul>
<li><label>Description</label><input type="text" name="todo" /></li>
<li><label>To be completed by</label><input type="text" name="date" id="date" /></li>
<li><label>Assign to</label><select name="user">
<?php foreach($users->result() as $row) { ?>
<option value="<?=$row->id?>"><?=$row->fname?></option>
<?php } ?>
</select></li>
<li><input class="submit" type="submit" value="Add todo" /></li>
</ul>
</form>
</div>